﻿/*
#**************************************************************************
#  openSIS is a student information system for public and non-public 
#  schools from Open Solutions for Education, Inc. web: www.os4ed.com
#
#  openSIS is  web-based, open source, and comes packed with features that 
#  include student demographic info, scheduling, grade book, attendance, 
#  report cards, eligibility, transcripts, parent portal, 
#  student portal and more.   
#
#  Visit the openSIS web site at http://www.opensis.com to learn more.
#  If you have question regarding this system or the license, please send 
#  an email to info@os4ed.com.
#
#  This program is released under the terms of the GNU General Public License  
#  as  published by the Free Software Foundation, version 2 of the License. 
#  See license.txt.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#**************************************************************************** 

*/


function OpenModal(modalpopup) {

    toolTip('');
    var modalPopup = $find(modalpopup);
    modalPopup.show();
    return false;
    //setTimeout("f", 20000);


}

//----------------------------------------------------------------------------------------------------
//function ddlCategoryOnSelectedIndexChange(table) {
//    
//    alert(table);
//    var selectedText = document.getElementById('<%= ddlCategory.ClientID %>').options[document.getElementById('<%= ddlCategory.ClientID %>').selectedIndex].text;

//    alert(document.getElementById('<%= ddlCategory.ClientID %>'));


//    if (selectedText == "<< Add New >>") {
//        alert('inside add new');
//        document.getElementById(table).style.display = 'block';
//    }
//    else {
//        alert('inside else');
//        document.getElementById(table).style.display = 'none';

//        document.getElementById('<%= txtCategoryName.ClientID %>').visible = false;
//    }

//    false;
//}
//function ClientValidate(source, arguments) {

//    var CustomValidator1 = document.getElementById('<%= CustomValidator1.ClientID %>');
//    var tableaddnew = document.getElementById('<%= TableAddNew.ClientID %>');
//    alert(tableaddnew.style.display);
//    if (tableaddnew.style.display == 'block') {

//        alert(document.getElementById('<%= txtCategoryName.ClientID %>').value);
//        if (document.getElementById('<%= txtCategoryName.ClientID %>').value != "") {
//            arguments.IsValid = true;
//        }
//        else {
//            arguments.IsValid = false;
//        }


//    }
//    else {
//        arguments.IsValid = true;
//    }
//    alert(arguments.IsValid);
//    return;
//}


////----------------------------------------------------------------------------------------------------
//function ddlFieldTypeOnSelectedIndexChange(panel, lblmsg, lblmsgCtrl, txtListitems, btnSaveControlListItems, TableListItem) {


//    var selectedvalue = document.getElementById('<%= ddlFieldType.ClientID %>').options[document.getElementById('<%= ddlFieldType.ClientID %>').selectedIndex].value;

//    if (selectedvalue == 2) {


//        document.getElementById(panel).style.display = 'block';

//        document.getElementById(TableListItem).style.display = 'block';

//        document.getElementById(lblmsg).style.display = 'block';

//        document.getElementById(lblmsgCtrl).style.display = 'block';
//        document.getElementById(lblmsgCtrl).innerText = "check box";

//        document.getElementById(txtListitems).style.display = 'block';
//        document.getElementById(btnSaveControlListItems).style.display = 'block';

//    }
//    else if (selectedvalue == 3) {
//        document.getElementById(panel).style.display = 'block';

//        document.getElementById(TableListItem).style.display = 'block';

//        document.getElementById(lblmsg).style.display = 'block';

//        document.getElementById(lblmsgCtrl).style.display = 'block';
//        document.getElementById(lblmsgCtrl).innerText = "radio button";

//        document.getElementById(txtListitems).style.display = 'block';
//        document.getElementById(btnSaveControlListItems).style.display = 'block';
//    }
//    else if (selectedvalue == 4) {
//        document.getElementById(panel).style.display = 'block';

//        document.getElementById(TableListItem).style.display = 'block';

//        document.getElementById(lblmsg).style.display = 'block';

//        document.getElementById(lblmsgCtrl).style.display = 'block';
//        document.getElementById(lblmsgCtrl).innerText = "dropdown list";

//        document.getElementById(txtListitems).style.display = 'block';
//        document.getElementById(btnSaveControlListItems).style.display = 'block';
//    }
//    else if (selectedvalue == 0) {


//        document.getElementById(TableListItem).style.display = 'none';

//        document.getElementById(lblmsg).style.display = 'none';

//        document.getElementById(lblmsgCtrl).style.display = 'none';


//        document.getElementById(txtListitems).style.display = 'none';
//        document.getElementById(btnSaveControlListItems).style.display = 'none';
//    }
//    else if (selectedvalue == 1) {


//        document.getElementById(TableListItem).style.display = 'none';

//        document.getElementById(lblmsg).style.display = 'none';

//        document.getElementById(lblmsgCtrl).style.display = 'none';


//        document.getElementById(txtListitems).style.display = 'none';
//        document.getElementById(btnSaveControlListItems).style.display = 'none';
//    }
//    else if (selectedvalue == 5) {


//        document.getElementById(TableListItem).style.display = 'none';

//        document.getElementById(lblmsg).style.display = 'none';

//        document.getElementById(lblmsgCtrl).style.display = 'none';


//        document.getElementById(txtListitems).style.display = 'none';
//        document.getElementById(btnSaveControlListItems).style.display = 'none';
//    }

//    false;
//}


function GridCheckBoxSelectionsetup(culture) {
   
    var checked = 0;
    var sessionValue = culture;

 
    for (i = 0; i < document.aspnetForm.elements.length; i++) 
    {
        if (document.aspnetForm.elements[i].name.indexOf("chkrow") > -1 || document.aspnetForm.elements[i].name.indexOf("chkRow") > -1) 
        {
            if (document.aspnetForm.elements[i].checked == true) 
            {
                var checked = checked + 1;
               
            }

        }
    }
    if (checked > 1)
     {

         for (j = 0; j < document.aspnetForm.elements.length; j++)
         {
             if (document.aspnetForm.elements[j].name.indexOf("chkrow") > -1 || document.aspnetForm.elements[j].name.indexOf("chkRow") > -1)
              {
                 document.aspnetForm.elements[j].checked = false;
             }

         }

         
      
            if(sessionValue=="en-US") {
                    alert('Please select only one row');
             }
            if(sessionValue=="es-MX"){
                alert('Por favor, elija sólo una fila');
            }
            if (sessionValue == "it-IT") {
                alert('Si prega di selezionare solo uno riga');
            }
            if (sessionValue == "de-DE") {
                alert('Bitte wählen Sie nur eine Zeile');
            }
            if (sessionValue == "fr-FR") {
                alert('vous plaît sélectionnez uniquement une rang');
            }
            if (sessionValue == "ru-RU") {
                alert('Пожалуйста, выберите только одну строку');
            }
            if (sessionValue == "pt-BR") {
                alert('agradar Selecione apenas uma fila');
            }
            if (sessionValue == "ja-JP") {
                alert('つだけ行を選択してください');
            }
            if (sessionValue == "ko-KR") {
                alert('제발 하나만 행을 선택 ');
            }
            if (sessionValue == "ar-SA") {
                alert('من فضلك رتخا فقط واحد صف');
            }
            if (sessionValue == "zh-CN") {
                alert('请仅选择一列行');
            }
          
        return false;


    }

    //*******

    else if (checked == 0) {


    //alert('Please select atleast one row');

    if (sessionValue == "en-US") {
        alert('Please select atleast one row');
    }
    if (sessionValue == "es-MX") {
        alert('Por favor, seleccione al menos una fila');
    }
    if (sessionValue == "it-IT") {
        alert('Si prega di selezionare almeno uno riga');
    }
    if (sessionValue == "de-DE") {
        alert('Bitte wählen Sie mindestens eine Zeile');
    }
    if (sessionValue == "fr-FR") {
        alert('vous plaît sélectionner au moins une rangée');
    }
    if (sessionValue == "ru-RU") {
        alert('Пожалуйста, выберите по крайней мере одну строку');
    }
    if (sessionValue == "pt-BR") {
        alert('agradar Selecione pelo menos uma fila');
    }
    if (sessionValue == "ja-JP") {
        alert('どうぞ選択少なくとも一つ行');
    }
    if (sessionValue == "ko-KR") {
        alert('이상이어야 하나의 행을 선택하시기 바랍니다 ');
    }
    if (sessionValue == "ar-SA") {
        alert('من فضلك رتخا على الأقل واحد صف');
    }
    if (sessionValue == "zh-CN") {
        alert('请选择至少一个行');
    }
        
        
        return false;
    }

    toolTip('');

}
